package copyengine.ui.dialog.animation
{
	import copyengine.ui.dialog.CEDialog;
	import copyengine.ui.dialog.copyengine_dialog_internal;
	import copyengine.utils.tick.GlobalTick;
	
	import flash.display.MovieClip;

	public class MovieClipTweenDialogAnimation implements ICEDialogAnimation
	{
		private var showDilaogEffect:MovieClip;

		private var closeDialogEffect:MovieClip;

		private var targetDialog:CEDialog;

		public function MovieClipTweenDialogAnimation(_showDialogEffect:MovieClip, _closeDialogEffect:MovieClip)
		{
			showDilaogEffect = _showDialogEffect;
			closeDialogEffect = _closeDialogEffect;
		}

		public function setTarget(_dialog:CEDialog):void
		{
			targetDialog = _dialog;
		}

		public function showDialog(_callBackFunction:Function):void
		{
			use namespace copyengine_dialog_internal;
			GlobalTick.instance.playTweenEffect(targetDialog.getDialogContainer(), showDilaogEffect, _callBackFunction);
		}

		public function closeDialog(_callBackFunction:Function):void
		{
			use namespace copyengine_dialog_internal;
			GlobalTick.instance.playTweenEffect(targetDialog.getDialogContainer(), closeDialogEffect, _callBackFunction);
		}

		public function dispose():void
		{
			showDilaogEffect = null;
			closeDialogEffect = null;
			targetDialog = null;
		}
	}
}
